﻿CREATE FUNCTION [sp_ssiscatalog].[get_context_type_desc_from_context_type]
(
	@context_type		smallint
)
RETURNS	TABLE AS
		RETURN
		SELECT	[context_type_desc]=	CONVERT(NVARCHAR(MAX),		CASE	WHEN	@context_type	=	10		THEN	'Task'
																			WHEN	@context_type	=	20		THEN	'Pipeline'
																			WHEN	@context_type	=	30		THEN	'Sequence'
																			WHEN	@context_type	=	40		THEN	'For Loop'
																			WHEN	@context_type	=	50		THEN	'Foreach Loop'
																			WHEN	@context_type	=	60		THEN	'Package'
																			WHEN	@context_type	=	70		THEN	'Variable'
																			WHEN	@context_type	=	80		THEN	'Connection manager'
																			ELSE	NULL
																	END
							)                                                    